<template>
  <div class="common-body-wrapper">
    <search-header
      single-width="130"
      :searchList="searchList"
      @changeHeight="toRetTable"
      @confirmSearch="toSearch"
    ></search-header>
    <multi-fun-table
      :sortColumn="notFormatColumn"
      :orderType="sortType"
      :fixed-cols="fixedCols"
      :is-reset-table="isResetTable"
      :theads-info="theadsInfo"
      :tbodys-info="tbodysInfo"
      @handleMultiCheck="handleMultiCheck"
      @handleSortColumn="handleSortColumn"
      @searchFn="getList"
      @getNextPage="getNextPage"
    >
      <div class="operate-btn-group" slot="operateBtnGroup">
        <!-- <a class="ake_btn ake_btn_text" v-if="isPermmited('TRADER_COUPON:TRADER:EXPORT')" @click.prevent="exportData()">导出</a> -->
      </div>
      <template slot="tdCell" slot-scope="props">
        <el-table-column
          :fixed="props.fixed"
          :label="props.label"
          :min-width="props.minWidth"
          :width="props.width"
          :prop="props.prop"
          :sortable="props.sortable"
        >
          <template slot-scope="scope">
            <span v-if="'reno' == props.prop">{{scope.$index+1}}</span>
            <span v-else-if="'share' == props.prop && scope.row['shareFrom']">
              <!-- <a class="imgLink" @click="showDataModal(scope.$index)">查看</a> -->
              {{scope.row['shareFrom'] | mileSecondToDate}}至{{scope.row['shareTo'] | mileSecondToDate}}
            </span>
            <span v-else-if="'shareNo' == props.prop && scope.row['excludeTimeList']">
              <!-- <a class="imgLink" @click="showDataModal(scope.$index)">查看</a> -->
              {{scope.row['excludeTimeList'] | listToStr}}
            </span>
            <span
              v-else-if="'price' == props.prop || 'timeoutValue' == props.prop"
            >{{scope.row[props.prop] | formatMoney}}</span>
            <span
              v-else-if="'handlingRadio' == props.prop "
            >{{scope.row[props.prop] | formatMoney}}%</span>
            <span
              v-else-if="'updateTime' == props.prop"
            >{{scope.row[props.prop] | mileSecondToDate}}</span>
            <span v-else-if="'status' == props.prop && isPermmited('MGR:SHARE:MANAGE:AUDIT')">
              <span v-if="scope.row[props.prop]!==0">{{scope.row[props.prop] | status}}</span>
              <a
                v-else
                class="imgLink"
                @click="examineModal_open(scope.$index,scope.row.id)"
              >{{scope.row[props.prop] | status}}</a>
            </span>
            <span v-else>{{ scope.row[props.prop] }}</span>
          </template>
        </el-table-column>
      </template>

      <!--操作列内的按钮-->
      <template slot="operateCell" slot-scope="props">
        <el-table-column
          :fixed="props.fixed"
          :label="props.label"
          width="88"
          class-name="operateCell"
        >
          <template slot-scope="scope">
            <el-button
              title="审核车位"
              size="small"
              type="primary"
              class="ake_btn_text"
              v-if="isPermmited('MGR:SHARE:MANAGE:AUDIT') && scope.row.status===0"
              @click="examineModal_open(scope.$index,scope.row.id)"
            >审核</el-button>
          </template>
        </el-table-column>
      </template>
    </multi-fun-table>

    <table-pagination :size="total" :cur-page="pageNumber" @backData="getPagination"></table-pagination>

    <basic-modal ref="examineModal" static="true">
      <h3 slot="title">审核</h3>
      <div class="examineModalBody" slot="modal-body">
        <el-form ref="examine_form" :model="examineData" label-width="120px" :rules="rules">
          <el-form-item label="审核结果：">
            <el-radio-group v-model="examineData.status">
              <el-radio label="ADUIT_PASS">通过</el-radio>
              <el-radio label="ADUIT_REFUSE">拒绝</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="车位编号：" prop="parkingSpaceNumber">
            <el-input v-model="examineData.parkingSpaceNumber"></el-input>
          </el-form-item>
          <el-form-item label="备注：">
            <el-input type="textarea" v-model="examineData.remark"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <div class="modal-footer" slot="modal-footer">
        <button
          class="ake_btn ake_btn_text ake_btn_confirm"
          @click="examineModal_save($event,'examine_form')"
        >确定</button>
        <button class="ake_btn ake_btn_text modal-close" @click="closed('examineModal')">取消</button>
      </div>
    </basic-modal>
    <big-pic-modal ref="bigPicModal">
      <img
        slot="bigImgSlot"
        :src="bigImgPath | setImgPath"
        alt
        @error="imgError('../../', 'car', $event)"
      />
    </big-pic-modal>
  </div>
</template>

<script>
import common from "@mixins/common.js";
import stardardList from "@mixins/tables/stardardList.js";

//modal
import invokeModal from "@mixins/modal/invokeModal.js";
import BigPicModal from "@components/widgets/BigPicModal.vue";

// image
import images from "@mixins/image.js";

// 引进vue的js
import manage from "./js/manage.js";
export default {
  mixins: [common, stardardList, invokeModal, images, manage],
  components: {
    BigPicModal
  },
  data() {
    return {
      fixedCols: 3,
      total: 0,
      examineData: {
        spaceId: "",
        status: "",
        parkingSpaceNumber: "",
        remark: "幼稚鬼。。。"
      },
      rules: {
        parkingSpaceNumber: [
          { required: true, message: "请输入车位编号", trigger: "blur" }
        ]
      },
      //prop-返回数据的字段名称   proisNotInter:true,pNameisNotInter:true,，name-查询字段传参名称    text-显示名称  //initHidden  初始化不显示
      searchList: [
        {
          type: "text",
          isShow: false,
          name: "query_parkName",
          text: "停车场",
          value: ""
        },
        {
          type: "text",
          isShow: false,
          name: "query_parkingSpaceNumber",
          text: "车位编号",
          value: ""
        },
        {
          type: "text",
          isShow: false,
          name: "query_userPhone",
          text: "车主电话",
          value: ""
        },

        {
          type: "select",
          isShow: false,
          name: "query_status",
          text: "状态",
          value: "",
          options: [
            { name: "全部", value: "" },
            { name: "待审核", value: "0" },
            { name: "审核通过", value: "1" },
            { name: "审核拒绝", value: "2" },
            { name: "启用", value: "3" },
            { name: "暂停", value: "4" }
          ]
        }
      ],
      theadsInfo: [
        { index: 0, isShow: false, prop: "reno", text: "序号", width: 64 },
        {
          index: 1,
          isShow: false,
          prop: "userName",
          text: "业主姓名",
          sortable: true,
          minWidth: 180
        },
        {
          index: 2,
          isShow: false,
          prop: "userPhone",
          text: "车主电话",
          sortable: true,
          minWidth: 150
        },
        {
          index: 3,
          isShow: false,
          prop: "parkName",
          text: "停车场",
          sortable: true,
          minWidth: 180
        },
        {
          index: 4,
          isShow: false,
          prop: "parkingSpaceNumber",
          text: "车位编号",
          sortable: true,
          minWidth: 180
        },
        {
          index: 5,
          isShow: false,
          prop: "status",
          text: "状态",
          sortable: true,
          minWidth: 110
        },
        {
          index: 6,
          isShow: false,
          prop: "share",
          text: "共享日期",
          sortable: true,
          minWidth: 330
        },
        {
          index: 7,
          isShow: false,
          prop: "shareNo",
          text: "不共享日期",
          sortable: true,
          minWidth: 330
        },
        {
          index: 8,
          isShow: false,
          prop: "price",
          text: "共享价格",
          sortable: true,
          minWidth: 180
        },
        {
          index: 9,
          isShow: false,
          prop: "timeoutValue",
          text: "超时惩罚机制",
          sortable: true,
          minWidth: 150
        },
        {
          index: 10,
          isShow: false,
          prop: "handlingRadio",
          text: "共享手续费率",
          sortable: true,
          minWidth: 150
        },
        {
          index: 11,
          isShow: false,
          prop: "remark",
          text: "备注",
          sortable: true,
          minWidth: 140
        },
        {
          index: 12,
          isShow: false,
          prop: "updateBy",
          text: "最近修改人",
          sortable: true,
          minWidth: 160
        },
        {
          index: 13,
          isShow: false,
          prop: "updateTime",
          text: "最后修改时间",
          sortable: true,
          minWidth: 180
        }
      ],
      tbodysInfo: []
    };
  },
  methods: {
    confirmSearch(params) {
      this.getList();
    }
  }
};
</script>

<style lang="less" scoped>
.examineModalBody {
  padding: 20px 35px;
}
</style>